String.format = function(src) {
    if (arguments.length === 0)
        return null;
    var args = Array.prototype.slice.call(arguments, 1);
    return src.replace(/\{(\d+)\}/g, function(m, i) {
        return args[i];
    });
};

function heredoc(fn) {
    return fn.toString().split('\n').slice(1, -2).join('\n') + '\n';
}

var CONST={};
CONST.STR_CSS = heredoc(function() {/*!
#Panel {
    padding-top: 10px;
    padding-left: 15px;
}

#sessions li button {
    border: none;
    background:none;
    background-color: #eee;
}

#FileInput {
    border: 1px solid #bbb;
    background:none;
}

.SessionList {
    display:inline-block;
    min-width: 150px;
}

#Sessions > li > button:first-of-type {
    margin-left: 25px;
}

#Sessions > li > button {
    min-width: 85px;
}

small {
    float: right;
}
*/dummy();});

CONST.STR_LIST = heredoc(function() {/*!
<li id="checkBoxLi{0}">
    <span id="checkButton{0}"></span>
    <img src="mx://favicon/{1}" onerror="this.src='../_images/file_16.png'" width="16" height="16">
    <a href="{1}" rel="{1}" id="checkBoxLink{0}" onclick="return false;" title="{2}">{2}</a>
</li>
*/dummy();});

CONST.STR_HTML = heredoc(function() {/*!
<h1>傲游浏览器【上次未关闭页面】增强工具</h1>
<button onclick="bRefresh();">刷新【上次未关闭页面】</button>
<button onclick="bSaveSession();">保存【上次未关闭页面】</button>
<button onclick="bSaveSessionAsFile();">【上次未关闭页面】另存为</button>
<button onclick="bClearSession();">清空【上次未关闭页面】</button>
<button style="float:right" onclick="bClose();">关闭增强工具</button>
<hr />
<h2>已保存Session列表</h2>
<fieldset>
    <legend>导入Session</legend>
    <input id="FileInput" type="file"></input>
    <button onclick="bLoadFromFile();">从文件中导入</button>
</fieldset>
<hr />
*/dummy();});

CONST.STR_DUMMY_LINK = '[{"url":"dummy","title":"dummy","locked":false,"reopend":true,"build":true}]';

CONST.STR_OUTPUT_HTML = heredoc(function() {/*!
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <style type="text/css">
body{margin:0;padding:0;line-height:1.5;font-family:"Segoe UI",Tahoma,Geneva,Verdana,微软雅黑;font-size:10pt}a,h1,h2,li,p,ul{margin:0;padding:0;list-style:none;text-decoration:none}img{border:none}a{color:#06c}a:focus,a:hover{color:#06f}a:active{color:#039}::-webkit-scrollbar{width:12px;overflow:visible}::-webkit-scrollbar-button{height:0;width:0}::-webkit-scrollbar-track{background-clip:padding-box;border:1px solid transparent}::-webkit-scrollbar-track:horizontal{border-width:4px 0 0}::-webkit-scrollbar-track:hover{background-color:rgba(0,0,0,.05);border:1px solid rgba(0,0,0,.1)}::-webkit-scrollbar-track:horizontal:hover{border:1px solid rgba(0,0,0,.1)}::-webkit-scrollbar-track:active{background-color:rgba(0,0,0,.1);border:1px solid rgba(0,0,0,.2)}::-webkit-scrollbar-track:horizontal:active{border:1px solid rgba(0,0,0,.2)}::-webkit-scrollbar-thumb{background:rgba(0,0,0,.08);border:1px solid rgba(0,0,0,.1)}::-webkit-scrollbar-thumb:hover{background:rgba(36,36,36,.15)}button,input,select{font-family:"Segoe UI",Tahoma,Geneva,Verdana,微软雅黑}button{color:#333;cursor:pointer;padding:4px 15px;background:-webkit-gradient(linear,0 0,0 100%,from(#fff),to(#f6f6f6));border:1px solid #bbb;-webkit-box-shadow:0 1px 2px rgba(0,0,0,.1)}button:hover{color:#000;background:-webkit-gradient(linear,0 0,0 100%,from(#fff),to(#F0F7FF));border-color:#3599ff}button.current,button:active{color:#666;background:#DDD;border-color:#AAA;-webkit-box-shadow:0 1px 2px rgba(0,0,0,.1) inset}button:disabled{color:#999;background:#f8f8f8;border-color:#d6d6d6;-webkit-box-shadow:none}input[type=search]{width:220px;-webkit-appearance:none}textarea{margin:0 -6px;-webkit-appearance:none}::-webkit-input-placeholder{color:#999}:focus::-webkit-input-placeholder{opacity:0}input[type=password],input[type=search],input[type=text],textarea{padding:4px 6px;background:#fff;border:1px solid #aaa;outline:0}input[type=password]:hover,input[type=search]:hover,input[type=text]:hover,textarea:hover{border-color:#3499ff}input[type=password]:focus,input[type=search]:focus,input[type=text]:focus,textarea:focus{border-color:#537CA6}input[type=password]:disabled,input[type=search]:disabled,input[type=text]:disabled,textarea:disabled{color:#ccc;background:#f8f8f8}input[readonly],textarea[readonly]{background:#FFF;border-color:#ddd!important}input[type=search]::-webkit-search-decoration{-webkit-appearance:none;margin-right:4px;width:16px;height:16px;background:url(_images/search_16.png) no-repeat}input[type=search]::-webkit-search-cancel-button{-webkit-appearance:none;width:16px;height:16px;background:url(_images/search_cancel_16.png) no-repeat}select{-webkit-appearance:none;outline:0;padding:4px 20px 4px 6px;border:1px solid #bbb;background:url(../_images/select_dropdown.png) 100% 50% no-repeat,-webkit-gradient(linear,0 0,0 100%,from(#fff),to(#f6f6f6));cursor:pointer}select:hover{background:url(../_images/select_dropdown.png) 100% 50% no-repeat,-webkit-gradient(linear,0 0,0 100%,from(#fff),to(#F0F7FF));border-color:#3499ff}select:active{background:url(../_images/select_dropdown.png) 100% 50% no-repeat,-webkit-gradient(linear,0 0,0 100%,from(#DDD),to(#DDD));border-color:#aaa;-webkit-box-shadow:0 1px 2px rgba(0,0,0,.1) inset}select:disabled{color:#999;background:url(../_images/select_dropdown.png) 100% 50% no-repeat #f8f8f8;border-color:#d6d6d6;-webkit-box-shadow:none}header{display:-webkit-flex;-webkit-align-items:center;padding:4px;color:#fff;background:#16b}header h1{margin:6px 24px;font-size:21px;font-weight:400}header .sep{margin:0 16px;width:1px;height:30px;background:rgba(255,255,255,.15)}header button{color:#fff;cursor:pointer;padding:4px 15px;background:0 0;border:1px solid rgba(255,255,255,0);-webkit-box-shadow:none}header button:hover{color:#fff;background:rgba(255,255,255,.1);border:1px solid rgba(255,255,255,.5)}header button.current,header button:active{background:rgba(0,0,0,.3);border-color:#fff}header input[type=search],header input[type=text]{margin:0 10px;padding:4px 6px;color:#fff;background:0 0;border:1px solid rgba(255,255,255,.5)}header input[type=search]:focus,header input[type=search]:hover,header input[type=text]:focus,header input[type=text]:hover{color:#000;background:#fff;border-color:#fff}header input[type=search]::-webkit-input-placeholder,header input[type=text]::-webkit-input-placeholder{color:rgba(255,255,255,.75)}header input[type=search]:hover::-webkit-input-placeholder,header input[type=text]:hover::-webkit-input-placeholder{color:#aaa}header input[type=search]::-webkit-search-decoration{background-image:url(_images/search_white_16.png)}header input[type=search]:focus::-webkit-search-decoration,header input[type=search]:hover::-webkit-search-decoration{background-image:url(_images/search_16.png)}header input[type=search]::-webkit-search-cancel-button{background-image:url(_images/search_cancel_white_16.png)}header input[type=search]:focus::-webkit-search-cancel-button,header input[type=search]:hover::-webkit-search-cancel-button{background-image:url(_images/search_cancel_16.png)}nav{display:-webkit-flex;background:#ececec;padding:6px 8px;overflow:hidden}nav button:not(.current){background:0 0;-webkit-box-shadow:none}nav button:not(.current):hover{background-color:#eaf4ff}nav button:not(.current):active{background-color:#ccc}.mask{display:none;position:fixed;z-index:50;top:0;left:0;width:100%;height:100%;background:#000;opacity:.1}.dialog{position:absolute;z-index:60;top:50%;left:50%;min-width:320px;max-width:640px;cursor:default;background:#f5f5f5;border:1px solid #888;-webkit-box-shadow:0 1px 8px rgba(0,0,0,.3)}.dialog-header{display:-webkit-flex;overflow:hidden;padding:10px 8px 10px 14px;background:#ececec;border-bottom:1px solid #CCC}.dialog-header .title{width:0;-webkit-flex:1;font-weight:700;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.dialog-header .close{width:16px;height:16px;padding:1px;background:url(../_images/close.png) center center no-repeat}.dialog-header .close:hover{background-image:url(../_images/close_hover.png)}.dialog-header .close:active{background-image:url(../_images/close_active.png)}.dialog-content{padding:10px 16px;border-bottom:1px solid #CCC}.dialog-footer{overflow:hidden;padding:10px 16px;text-align:right;background:#ececec}.dialog-footer .dialog-ctrl{text-align:right}.dialog-footer button{min-width:80px}
        </style>
        <style type="text/css">
header{background-color:#82ac00}header .header-wrapper{display:-webkit-flex;margin:0 auto;width:560px}header h1{-webkit-flex:1;margin-left:0}header button{margin:6px 0}nav{box-sizing:border-box;z-index:99;width:100%}nav .nav-wrapper{display:-webkit-flex;-webkit-align-items:center;margin:0 auto;width:560px}#openPages{padding:6px 10px;min-width:120px}.recent-nav-container{-webkit-flex:1;text-align:right}.recent-nav-container a{position:relative;z-index:10;margin-left:-5px;padding:6px 10px;color:#666;text-decoration:none;background:#ececec;border:1px solid #bbb}.recent-nav-container button{position:relative;z-index:10;margin-left:-7px}.recent-nav-container button:hover{z-index:20}.content{z-index:9;margin:0 auto;width:560px}.page{margin:15px 0 20px}.page li{height:28px;line-height:26px;margin:0 5px 0 0;overflow:hidden;white-space:nowrap;position:relative;text-overflow:ellipsis}.page li span{position:absolute;left:4px;top:6px;width:16px;height:16px;opacity:.35;background:url(images/btn_del.png) 3px 3px no-repeat}.page li:hover span{opacity:1}.page li:hover span:hover{background:url(images/btn_del_hover.png) no-repeat}.page li img{position:absolute;left:30px;top:5px}.page li a{position:absolute;color:#000;left:54px;top:0;white-space:nowrap;text-overflow:ellipsis;overflow:hidden;max-width:500px}.page li.check a{text-decoration:line-through;color:#ccc}.page li.check span{display:block}.page li.check img{opacity:.3}.page li.reopend a{color:red}.page li a:hover{color:#06c}.page li.reopend a:hover{color:red}
        </style>
        <link rel="stylesheet" type="text/css" href="style.css" />
        <title>{0}</title>
    </head>
    <body>
        <div class="wrapper">
            <header>
                <div class="header-wrapper">
                     <h1>{0}</h1>
                </div>
            </header>
            <nav id="navigator">
                <div class="nav-wrapper">
                    <button id="openPages">全部打开</button>
                    <div class="recent-nav-container">
                    </div>
                </div>
            </nav>
            <div class="content" id="content">
                <ul class="page" id="pageList">{1}</ul>
            </div>
        </div>
    </body>
</html>
*/dummy();});